<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page import="com.mcms.util.DictUtil"%>
<%@ page import="com.mcms.util.MapUtil"%>
<%@ page import="com.mcms.web.vo.DictCache"%>
<%@ page import="java.util.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String actionType = request.getParameter("actionType").toString();
	String deptCode = request.getParameter("deptCode").toString();
	String tabId = (String)request.getParameter("tabId");
	String customId = UUID.randomUUID().toString();
	 
%>
<html xmlns="http://www.w3.org/1999/xhtml"> 
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=7" />
		<link href="<%=basePath%>mcms/themes/css/login.css" rel="stylesheet"
			type="text/css" />
		<title>客户信息管理系统</title>
		<script type="text/javascript">
<!--

//-->
// 是否预约select的change事件：是-显现预约信息层；否-不显现，并清空内容
function displayData(){
	var flag = $("#appointment option:selected").val();
     alert(flag);
	if(flag == '0' || flag == 0){
	alert("in");
		document.getElementById('dateDiv').style.display='block';
	}else{
	    document.getElementById('appointDate').value = '';
	    document.getElementById('appointmemo').value = '';
		document.getElementById('dateDiv').style.display='none';
	}
	
}
// 切换文件上传数据域的显示状态
function  displayFileInput(){
	var divObj = document.getElementById("fileInputDiv");
	if(divObj != undefined){
		document.getElementById('fileInputDiv').style.display='block';
	}
}

// 动态添加file域
function addFileInput(){
	//document.getElementById("fileInput").innerHTML = document.getElementById("fileInput").innerHTML + '<br/><input type="file" name="file" />';
	var oRow=document.all.fileInput.insertRow(); 
	var oCell=oRow.insertCell(); 
	oCell.innerHTML= '<input type="file" name="file" />';
}

// 提交客户信息表单，同时显示文件录入界面
function doSubmitCustForm(){
	document.getElementById("customInfo").submit();
}

// 已存在校验
function doCheckUniq(){
	var custName = document.getElementById("CUSTOM_NAME");
	var custPhone = document.getElementById("TELEPHONE_NO");
	//window.location.href="<%=request.getContextPath()%>/TransactionServlet?actionType=checkUniq&custName="+custName+"&custPhone="+custPhone;
	document.all.customInfo.action = "<%=request.getContextPath()%>/TransactionServlet?actionType=checkUniq&custName="+custName+"&custPhone="+custPhone;
	document.all.customInfo.submit();
}
</script>

	</head>
	<body>
		<form id="pagerForm" method="post" action="#rel#">
			<input type="hidden" name="pageNum" value="1" />
			<input type="hidden" name="numPerPage" value="${model.numPerPage}" />
			<input type="hidden" name="orderField" value="${param.orderField}" />
			<input type="hidden" name="orderDirection"
				value="${param.orderDirection}" />
		</form>

		<div class="pageContent">
			<!--
	<form method="post" action="<%=basePath%>addCustom_qd.html?userName=aaa&deptCode=sc&actionType=addCustom_qd" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
	-->
			<form id="customInfo" name="customInfo"
				action="<%=request.getContextPath()%>/TransactionServlet?userName=aaa&deptCode=sc&actionType=addCustom_qd&tabId=<%=tabId%>&customId=<%=customId%>"
				method="post"
				onsubmit="return iframeCallback(this, navTabAjaxDone);"> 
   
				<div class="pageFormContent" layoutH="56">
					<!-- 客户基本资料区域begin -->
					<p>
						<label>
							姓名 ：   
						</label>
						<input id="CUSTOM_NAME" name="CUSTOM_NAME" type="text" size="30"
							value="" class="required" alt="" />
						<span class="unit"></span> 
					</p>
					<p> 
						<label>
							联系手机：
						</label> 
						<input id="TELEPHONE_NO" name="TELEPHONE_NO" class="required digits" 
							type="text" size="30" value="" alt="" />  
						<span class="unit" onclick="document.getElementById('check').value='true';document.getElementById('saveForm').click();document.getElementById('check').value='false';">[已录入?]</span>
						<input type="hidden" name="check" id="check"/>
					</p>
					<p>
						<label>
							性别：
						</label>
						<select id="GENDER" name="GENDER" class="combox">
							<option value="">
								请选择
							</option>
							
							<%
							Map map = (Map)DictCache.getInstance().getDictMapByType("SEX");
							Set setInner =map.keySet();//       
							Iterator it=setInner.iterator();//       
							while(it.hasNext()){//     
								String key = (String) it.next();
								%>
								<option value="<%=key%>"><%=(String) map.get(key)%></option>
								<%
							}
							%>

						</select>
						<span class="unit"></span>
					</p>
					<p>
						<label>
							年龄：
						</label>
						<input id="AGE" name="AGE" type="text" size="30" value="" alt="" class="digits"/> 
					</p>

					
					<p>
						<label>
							籍贯：
						</label>
						<input id="NATIVE" name="NATIVE" type="text" size="30" value=""
							alt="" />
					</p>
					<p>
						<label>
							固定电话：
						</label>
						<input id="FIXED_TELEPHONE_NO" name="FIXED_TELEPHONE_NO"  class="phone"
							type="text" size="30" value="" alt="" />
					</p>
					<p>
						<label>
							住址：
						</label>
						<input id="ADDRESS" name="ADDRESS" type="text" size="30" value=""
							alt="" />
					</p>
					<p>
						<label>
							EMAIL：
						</label>
						<input id="EMAIL" name="EMAIL" type="text" size="30" value="" class="email"
							alt="" />
					</p>
					<p>
						<label>
							联系QQ：
						</label>
						<input id="QQ" name="QQ" type="text" size="30" value="" alt="" class="digits"/>
					</p>
					<p>
						<label>
							职业：
						</label>
						<input id="PROFESSION" name="PROFESSION" type="text" size="30"
							value="" alt="" />
					</p>
					<p>
						<label>
							工作地：
						</label>
						<input id="WORK_PLACE" name="WORK_PLACE" type="text" size="30"
							value="" alt="" />
					</p>
					<!-- 客户基本资料区域end -->

					<div class="divider"></div>

					<!-- 问诊信息区begin -->

					<p>
						<label>
							来院渠道：
						</label>
						<select id="channel" name="channel" class="required combox">
							<option value="">
								请选择
							</option>
							<%
							 map = (Map)DictCache.getInstance().getDictMapByType("CHANNEL");
							 setInner =map.keySet();//       
							 it=setInner.iterator();//       
							while(it.hasNext()){//     
								String key = (String) it.next();
								%>
								<option value="<%=key%>"><%=(String) map.get(key)%></option>
								<%
							}
							%>
						</select>
						<span class="unit"></span>
					</p>
					<p>
						<label>
							咨询项目：
						</label>
						<select id="refer_item" name="refer_item" class="required combox">
							<option value="">
								请选择
							</option>
							
							<%
							 map = (Map)DictCache.getInstance().getDictMapByType("REFER_ITEM");
							 setInner =map.keySet();//       
							 it=setInner.iterator();//       
							while(it.hasNext()){//     
								String key = (String) it.next();
								%>
								<option value="<%=key%>"><%=(String) map.get(key)%></option>
								<%
							}
							%>

						</select>
						<span class="unit"></span>
					</p>
					<p>
						<label>
							咨询医生：
						</label>
						<select id="refer_doctor" name="refer_doctor"
							class="required combox">
							<option value="">
								请选择
							</option>
							
							<%
							 map = (Map)DictCache.getInstance().getDictMapByType("USER");
							 setInner =map.keySet();//       
							 it=setInner.iterator();//       
							while(it.hasNext()){//     
								Object key = ((Object) it.next());
								%>
								<option value="<%=key.toString()%>"><%=((Object) map.get(key)).toString()%></option>
								<%
							}
							%>
						</select>
						<span class="unit"></span>
					</p>
					<p>
						<label>
							脱发情况：
						</label>
						<select id="bald_condition" name="bald_condition"
							class="required combox">
							<option value="">
								请选择
							</option>
							
							<%
							 map = (Map)DictCache.getInstance().getDictMapByType("BALD_CONDITION");
							 setInner =map.keySet();//       
							 it=setInner.iterator();//       
							while(it.hasNext()){//     
								String key = (String) it.next();
								%>
								<option value="<%=key%>"><%=(String) map.get(key)%></option>
								<%
							}
							%>
						</select>
						<span class="unit"></span>
					</p>
					<p>
						<label>
							脱发时长：
						</label>
						<select id="bald_duration" name="bald_duration"
							class="required combox">
							<option value="">
								请选择
							</option>
							
							<%
							 map = (Map)DictCache.getInstance().getDictMapByType("BALD_DURATION");
							 setInner =map.keySet();//       
							 it=setInner.iterator();//       
							while(it.hasNext()){//     
								String key = (String) it.next();
								%>
								<option value="<%=key%>"><%=(String) map.get(key)%></option>
								<%
							}
							%>

						</select>
						<span class="unit"></span>
					</p>
					<p>
						<label>
							脱发级别：
						</label>
						<select id="bald_level" name="bald_level" class="required combox">
							<option value="">
								请选择
							</option>
							
							<%
							 map = (Map)DictCache.getInstance().getDictMapByType("BALD_LEVEL");
							 setInner =map.keySet();//       
							 it=setInner.iterator();//       
							while(it.hasNext()){//     
								String key = (String) it.next();
								%>
								<option value="<%=key%>"><%=(String) map.get(key)%></option>
								<%
							}
							%>

						</select>
						<span class="unit"></span>
					</p>
					<p>
						<label>
							是否有家族遗传史：
						</label>
						<select id="is_inberit" name="is_inberit" class="required combox">
							<option value="">
								请选择
							</option>
							
							
							<%
							 map = (Map)DictCache.getInstance().getDictMapByType("YN");
							 setInner =map.keySet();//       
							 it=setInner.iterator();//       
							while(it.hasNext()){//     
								String key = (String) it.next();
								%>
								<option value="<%=key%>"><%=(String) map.get(key)%></option>
								<%
							}
							%>

						</select>
						<span class="unit"></span>
					</p>
					<p>
						<label>
							是否有药物治疗史：
						</label>
						<select id="is_treat" name="is_treat" class="required combox">
							<option value="">
								请选择
							</option>
							
							
							<%
							 map = (Map)DictCache.getInstance().getDictMapByType("YN");
							 setInner =map.keySet();//       
							 it=setInner.iterator();//       
							while(it.hasNext()){//     
								String key = (String) it.next();
								%>
								<option value="<%=key%>"><%=(String) map.get(key)%></option>
								<%
							}
							%>
						</select>
						<span class="unit"></span>
					</p>

					<!-- 问诊信息区end -->
					<div class="divider"></div>
					<div id="dateDiv" style="display: block;">
						<p>
							<label>
								是否预约就诊：
							</label>

							<select id="is_subscribe_doctor" name="is_subscribe_doctor"
								class="combox" onchange="">
								<option value="">
									请选择
								</option>
								<%
								 map = (Map)DictCache.getInstance().getDictMapByType("YN");
								 setInner =map.keySet();//       
								 it=setInner.iterator();//       
								while(it.hasNext()){//     
									String key = (String) it.next();
									%>
									<option value="<%=key%>"><%=(String) map.get(key)%></option>
									<%
								}
								%>
							</select>
							<!--  
					<a class="button" href="<%=basePath%>doctor_appointment.html?actionType=yyjz" target="dialog" rel="dlg_page9"><span>预约就诊</span></a>-->
							<span class="unit"></span>
						</p>
						<p>
							<label>
								预约就诊日期：
							</label>
							<input type="text" id="subscribe_doctor_time"
								name="subscribe_doctor_time" class="date" size="30" />
							<a class="inputDateButton" href="javascript:;">选择</a>
						</p>
						<dl class="nowrap">
							<dt>
								备注：
							</dt>
							<dd>
								<textarea id="remark" name="remark" cols="80" rows="2"></textarea>
							</dd>
						</dl>

					</div>
					<div class="formBar">
						<ul>
							<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
							<li>
								<div class="buttonActive">
									<div class="buttonContent">
										<button type="submit" id="saveForm" > 
											保存
										</button>
									</div>
								</div>
							</li>
							<li>
								<div class="button">
									<div class="buttonContent">
										<button type="button" class="close">
											取消
										</button>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</form>

			<%
				if ("dw".equals(deptCode)) {
			%>
			<div id="fileInputDiv" style="display: block">
				<form
					action="<%=request.getContextPath()%>/TransactionServlet?userName=aaa&deptCode=sc&actionType=imgUpload&customId=<%=customId%>"
					method="post" enctype="multipart/form-data"
					onsubmit="return iframeCallback(this, navTabAjaxDone);">
					<div class="divider"></div>
					
					<div id="dateDiv" height="20" style="display: block;">
						<b>照片上传：</b>&nbsp;&nbsp;
						<br/> 
						<img onclick="addFileInput()" src="<%=basePath %>themes/default/images/add_file.png" alt="添加一个文件"/>
						<br/>
						<table id="fileInput">
							<tr><td><input type="file" name="file" /></td></tr>
						</table>
					</div>
					
					<div class="formBar"> 
						<ul>
							<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
							<li>
								<div class="buttonActive">
									<div class="buttonContent">
										<button id="imgSubmit" name="imgSubmit" type="submit">上传</button>
									</div>
								</div>
							</li>
							<li>
								<div class="button">
									<div class="buttonContent">
										<button id="imgCancel" name="imgCancel" type="button" class="close">取消</button>
									</div>
								</div>
							</li>
						</ul>
					</div>
					
				</form>
			</div>
			<%
				}
			%>


		</div>


	</body>
</html>